<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page session="true"%>

<html> 

<head>
	<META http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Order</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/web.css" type="text/css" media="screen, projection"/>
</head>	

<body>

<div class="container">
    <%@include file="../common/header.jsp" %>
    <br/>
    <br/>
	<h2>Order list</h2>
</div>

	<div class="span-12last">	
		<form:form modelAttribute="order" action="delete" method="post">
            <table width="100%" border="1" cellpadding="2" cellspacing="0">
                <thead>
                    <tr>
                        <th>&nbsp;</th>
                        <th>OrderID</th>
                        <th>Customer</th> 
                        <th>Status</th>
                        <th>Total</th>
                        <th>Date Added</th>
                        <th>Date modified</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <c:forEach items="${orders}" var="order">
                    <tr>
                        <td><input type="checkbox" name="id" value="${order.id}"/></td>
                        <td><c:out value="${order.name}"/></td>
                        <td><c:out value="${order.customer.name}"/></td>
                        <td><c:out value="${order.status}"/></td>
                        <td><c:out value="${order.total}"/></td>
                        <td><c:out value="${order.dateAdd}"/></td>
                        <td><c:out value="${order.dateModified}"/></td>
                        <td><a href="${order.id}">Edit</a></td>
                    <tr/>
                    </c:forEach>   
                </tbody>
            </table>
            <br/>
            <div class="save">
            	<input type="button" value="Insert new order" onclick="window.location.href='create';"/> &nbsp;&nbsp; <input type="submit" value="Delete selected order"/>
			</div>
		</form:form>
	</div>
	<div class="footer">
    	<%@include file="../common/footer.jsp" %>
    </div>
</body>

</html>